<style lang="less" scoped>
@import "../assets/css/config.less";
html {
  font-size: 12px;
}
// @media screen and (max-width: 1350px) {
//   .index-center{
//     width: 60%;
//   }
//   .index-right{
//     width: 20%;
//   }
// }
.del-note{
  display: flex;
  justify-content: flex-end;
}
.show-more {
  width: 30px;
  height: 30px;
  border: @border;
  margin-right: 30px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  cursor: pointer;
  &:hover .icon{
    color: @color2;
  }
  .icon {
    color: rgb(248, 168, 103);
  }
}
.flex-row {
  display: flex;
  justify-self: start;
}

.flex-column {
  display: flex;
  flex-direction: column;
}
.flex-row-center {
  display: flex;
  justify-content: center;
}
.flex-space-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.title-row {
  position: relative;
  .more {
    position: absolute;
    right: 10px;
    line-height: 30px;
    font-size: 13px;
    cursor: pointer;
    &:hover {
      color: @color2;
      text-shadow: 0 0 1px @color2;
    }
  }
}

.homework-area {
  border-left: 1px solid #e0e0e0;
  margin: 0px 0;
  padding: 20px 0;
  min-height: 600px;
}
.homework {
  margin: 0 auto;
  width: 200px;
}
.homework-list {
  border-radius: 0.25rem;

  min-height: 5rem;
  padding: 8px 10px 2px;
  text-align: left;
  font-size: 14px;
  border: 1px solid #e0e0e0;
  // box-shadow: 0 0 3px 0 rgb(175, 172, 172);
  margin: 0 auto 0.9375rem auto;
  cursor: default;
  &:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 8px 0 rgb(175, 172, 172);
  }
  .title {
    font-size: 0.875rem;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    overflow: hidden;
  }
  .need {
    font-size: 13px;
    font-weight: 400;
    margin: 15px 0;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
  }
  .foot {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    align-items: center;
    margin-bottom: 0.3125rem;
    .time {
      font-size: 12px;
    }
    button {
      outline: none;
      padding: 0.2125rem 0.425rem;
      border-radius: 13px;
      border: 0.0625rem solid @color2;
      background-color: @white;
      color: @color1;
      &:hover {
        background-color: @color2;
        color: @white;
      }
      &:active {
        background-color: @color3;
        color: @white;
      }
      &:disabled {
        background-color: rgb(253, 249, 247);
        border-color: #ffd0b4;
        color: rgb(243, 165, 113);
        cursor: not-allowed;
      }
    }
    img {
      width: 15px;
      height: 15px;
      margin: 0 5px 0 10px;
    }
    p {
      line-height: 15px;
    }
  }
}

.homework-btn {
  margin: 0 auto 15px;
  background-color: @color1;
  color: @white;
  width: 200px;
  padding: 8px;
  outline: none;
  border: none;
  font-size: 14px;
  letter-spacing: 5px;
  border-radius: 0.25rem;
  cursor: default;
  &:hover {
    background-color: @color2;
  }
  &:active {
    background-color: @color3;
  }
}
.index-card {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin: 5px 0 15px 0;
  cursor: pointer;
    overflow: hidden;
  &:hover {
    color: @color1;
  }
  .index-card-left{
    display: flex;
    justify-content: flex-start;
    width: 140px;
    line-height: 25px;
    font-size: 14px;
    font-weight: 600;
    .item-icon {
      width: 25px;
      height: 25px;
      margin-right: 10px;
    }
  }
  .index-card-right {
    text-align: left;
    font-size: 14px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
  }
}

.user-list {
  margin: 25px auto;
  width: 90%;
}
.user-list-bgc {
  width: 100%;
}
.user-list-item {
  width: 112px;
  margin: 0 auto;
  padding: 5px 0;
  text-align: left;
  font-size: 14px;
}
.user-list-bgc:hover {
  font-size: 14px;
  color: @color2;
  background-color: @hover-bgc;
  cursor: pointer;
}
.user-area {
  border-radius: 4px;
  background-color: @header-bgc;
  width: 100%;
  height: 100%;
  padding: 40px 0 0 0;
  min-height: 500px;
  .username{
    line-height: 24px; 
    font-size: 14px;
    width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap; //文本不换行，这样超出一行的部分被截取，显示...
  }
}
.user-area .user-pic {
  position: relative;
  margin: 0px auto;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  // padding: 40px 0 0 0;
  overflow: hidden;
  padding: -2px;
}

.index-center .title {
  font-size: 18px;
  border-bottom: 1px solid #f0f0f1;
  padding: 0 0 5px 0;
}
.index-out {
  padding: 30px 30px;
  min-width: 1210px;
  width: 100%;
  display: flex;
  justify-content: start;
}
.index-left {
  width: 20%;
  max-width: 15.625rem;
  padding: 0px 20px 0 0;
}
.index-center {
  width: 60%;
  margin: 0 auto;
  padding: 10px 20px;
}
.index-right {
  width: 20%;
  padding: 0px 0 0 15px;
}
.index {
  background: #f8f8f9;
}
.loading {
  animation: myloading 1s linear infinite;
  margin-top: 100px;
}
@keyframes myloading {
  from {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(180deg);
  }
  to {
    transform: rotate(360deg);
  }
}
// #content{
//   display: flex;
//   justify-content: center;
// }
.el-icon-star-on {
  color: #ffaf03;
}
.el-icon-star-off {
  color: #c9ccc3;
}

.title {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.exersize-card {
  margin: 10px 0;
}
.exersize-card p {
  font-weight: 600;
}

.list {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
}
.card {
  width: 75%;
  margin-top: 40px;
}

.card_item {
  width: 90%;
  margin: 0 auto;
  div,
  p {
    text-align: left;
  }
}

.out {
  // overflow: scroll;
  padding-top: 50px;
}

.box {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.card_row {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
}

a.one:link {
  color: #ff0000;
}

.right_side {
  position: fixed;
  top: 180px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: left;
}
.allquestion,
.answer {
  margin-top: 20px;
}
.time {
  // position: absolute;
  font-size: 14px;
  // right: 60px;
  color: #8a8a8a;
  font-weight: 500;
}
h3 {
  text-align: left;
  padding: 0 0 8px 0;
}
.el-pagination.is-background .el-pager li:not(.disabled).active {
  background-color: @color2 !important;
  color: #fff !important;
}
.number.el-tooltip.item:hover {
  color: @color2 !important;
}
.menu {
  display: flex;
  flex-direction: column;
  width: 20%;
  // overflow:auto;
  // height:100%;
  padding: 0 30px 30px;
  // background-color: #F7F6F4;
  div {
    // height: 100%;
    background-color: #f7f6f4;
  }
}
.pointview-area {
  width: 100%;
  display: flex;
  justify-content: start;
}
.point-button {
  font-size: 13px;
  width: 120px;
  line-height: 32px;
  background-color: #f7e4d9;
  color: #000;
  margin-bottom: 15px;
  cursor: pointer;
  &:hover {
    background-color: #fadbc9;
    transform: translateY(-1px);
    box-shadow: 2px 2px 4px 0 rgb(228, 225, 225);
  }
}
.change-avatar {
  background-color: rgba(0, 0, 0, 0.6);
  color: #fff;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  // display: flex;
  justify-content: center;
  align-items: center;
  cursor: default;
  display: none;
  &:hover {
    display: flex;
  }
}
.avatar {
  background-color: #fff;
}
.avatar:hover + .change-avatar {
  display: flex;
}
</style>
<style lang="less">
@import "../assets/css/config.less";
@import "../assets/css/prism.css";
.point-table {
  width: 100%;
  border: @border;
  margin: 8px 0;
  tr {
    th {
      padding: 3px 15px;
      &:nth-child(2) {
        border-left: @border;
      }
    }
    &:nth-child(2n) {
      background-color: #f6f4f0;
    }
    td {
      padding: 3px 15px;
      &:nth-child(2) {
        border-left: @border;
      }
    }
  }
}
.content-foot {
  margin-top: 40px;
  padding:0 20px 0 20px;
  position: relative;
  .pre {
    float: left;
  }
  .next {
    float: right;
  }
  .pre,.next{
    display: flex;
    align-items: center;
    line-height: 24px;
    cursor: pointer;
    color: rgb(117, 107, 107);
    &:hover{
      color: @color1;
    }
    &:active{
      color: @color2;
    }
  }
  p {
    font-size: 18px;
    line-height: 24px;
    margin: 0 5px;
  }
}
.word-point pre {
  white-space: pre-wrap;
}
.word-point img {
  max-height: 500px;
}
p.MsoNormal {
  margin: 5px 0 5px;
}
.point-content {
  h1,
  h2,
  h3,
  h4,
  h5 {
    padding: 5px 0 0px;
  }
}
.code-demo {
  display: block;
  width: 120px;
  text-align: center;
  font-size: 13px;
  border: 1px solid @color1;
  border-radius: 6px;
  background-color: @color6;
  color: @color1;
  padding: 5px 15px;
  margin: 0 0 10px;
  &:hover {
    background-color: @color2;
    color: @white;
  }
  &:active {
    background-color: @color3;
  }
}
.ivu-card-body li {
  margin-left: 15px;
}

.mysider {
  text-align: left;
}
.mysider .ivu-icon-ios-arrow-down {
  right: 0 !important;
}
.ivu-icon-md-checkmark {
  color: #3fe203;
}

.column-one {
  width: 16px;
  height: 100px;
}
.sider-out {
  overflow: auto;
}
.point-content {
  font-size: 15px;
}
.pageIndex {
  top: 0;
  left: 0;
  width: 75%;
  height: 80px;
  background: rgb(255, 255, 255);
  position: absolute;
  z-index: 10;
  .point {
    float: left;
    width: 100%;
  }
}
.path-name-list {
  width: 100%;
  font-size: 16px;
  font-weight: 520;
  height: 30px;
  border: 1px solid #dcdee2;
  color: #000;
}
.item {
  margin: 4px;
}
.pathpage-number {
  width: 28px;
  height: 28px;
  background-color: #f4f4f5;
}
.path-item {
  margin-bottom: 8px;
  width: 100%;
  // position: absolute;
  height: 5%;
}
.path {
  padding: 0;
  position: absolute;
  background: #fff;
  width: 178px;
  height: 100%;
  right: 0;
  float: left;
  display: flex;
  overflow: hidden;
  flex-direction: column;
  justify-content: space-between;
}
.path-top-btn {
  position: absolute;
  font-size: 16px;
  font-weight: 520;
  color: #606266;
  border: 1px solid #dcdee2;
  border-radius: 4px;
  width: 49%;
  background-color: #fff;
  height: 32px;
  letter-spacing: 3px;
}
.path-top-btn:hover {
  color: @white;
  background-color: @color2;
}
.path-top {
  font-size: 16px;
  font-weight: 520;
  color: #606266;
  border: 1px solid #dcdee2;
  width: 100%;
  background-color: #fff;
  border-radius: 4px;
  height: 5%;
  letter-spacing: 3px;
}
.tag-box {
  // position: absolute;
  width: 100%;
  height: 87.5%;
  margin-top: 35px;
  margin-bottom: 4%;
}
.path-top:hover {
  color: #fff;
  background-color: @color2;
}
.pathname-list {
  width: 100%;
  height: 95%;
  margin-top: 3%;
  margin-bottom: 4%;
  overflow-y: auto;
  overflow-x: hidden;
}
.path-item-icon {
  float: right;
  margin: 10px 5px;
}
.path-item-icon:hover {
  color: red;
}
.path-outside {
  margin-left: 0px;
  position: absolute;
  border-left: 1px solid #dcdee2;
  width: 180px;
  background: #fff;
  // height: 200px;
  right: 0;
  top: 0;
  overflow: hidden;
  z-index: 20;
}
.path-tip {
  margin: 10px 20px 0 10px;
  padding-top: 240px;
  font-size: 16px;
  width: 80%;
  height: 100%;
}

// .path-btn-outside:hover{
//   border:1px solid @color2;
//   color: @color2;
// }
.path-btn {
  position: absolute;
  top: 20%;
  height: 115px;
  width: 34px;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  background-color: rgb(255, 255, 255);
  color: #606266;
  padding: 8px;
  text-align: center;
  font-size: 16px;
}
.path-btn:hover {
  border: 1px solid @color2;
  color: @color2;
}
.tag {
  width: 100%;
  height: 30px;
  margin-right: 5px;
}
.recommend-type {
  margin-top: 60px;
  margin-bottom: 12px;
  position: relative;
  bottom: 28px;
}
.recommend-type-title {
  text-align: left;
  top: 8px;
  position: absolute;
  float: left;
  font-weight: 1000;
}
.recommend-type-title-flags {
  text-align: left;
  top: 8px;
  position: absolute;
  float: left;
  font-weight: 1000;
  width: 200px;
}
.recommend-content {
  text-align: left;
  margin: 100px auto 0 auto;
  height: 200px;
  overflow: auto;
}
.recommend-group {
  position: absolute;
  float: left;
  left: 120px;
  top: 45px;
  width: 200px;
}

.tag-close {
  float: right;
  margin-top: 8.5px;
}
.view-area {
  position: absolute;
  right: 235px;
  display: flex;
  justify-content: flex-end;
  cursor: default;
}

.view-area div {
  padding: 5px;
  border: 1px solid #dcdfe6;
  width: 75px;
  border-radius: 1px;
}

.view-btn:hover {
  border: 1px solid #c6e2ff;
  background-color: #ecf5ff;
  color: @color2;
}

.view-checked {
  background-color: #2d3e50;
  color: #fff;
}
.view-checked:hover {
  background-color: #525555;
  color: #fff;
}
.mask-layer {
  width: 100%;
  height: 100%;
  top: 0px;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 105;
  position: fixed;
  left: 0;
  overflow: auto;
}

.word-point {
  position: relative;
  padding: 5px 0 15px;
}
.wordview-container {
  background-color: #fff;
  padding: 10px 170px 100px 50px;
  text-align: left;
  width: 100%;
  min-height: 100%;
}
.wordview-container h2 {
  font-size: 18px;
  padding: 10px 20px;
}
.wordview-container .content {
  font-size: 14px;
  padding: 0px 20px;
}
.focus-point {
  // height: 100%;
  // min-width: 1000px;
  width: 970px;
  background-color: #fbfbfb;
  opacity: 1;
  margin: 80px auto;
  border-radius: 4px;
  text-align: left;
  padding: 1px 0;
}

.hovering {
  border: 1px solid #ccc;
  box-shadow: 0 1px 2px 1px #ccc;
  border-radius: 4px;
  margin: -1px;
}

img.note-icon {
  width: 16px;
  height: 16px;
  margin-right: 5px;
}
.note-area {
  min-height: 50px;
  width: 100%;
  border-radius: 4px;
  margin: 20px 0px 0 0px;
}
.item-header {
  background-color: #f6f5f4;
  padding: 18px;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  box-shadow: 0 4px 8px -2px #678981;
}
.note-edit {
  margin: 0 25px;
  // background-color: #fff;
}
.add-note-button {
  display: flex;
  align-items: center;
  cursor: pointer;
}
.note-item {
  background-color: #fff;
  padding: 15px 25px;
  font-size: 15px;
}
.note-item .note {
  font-size: 15px;
  padding: 10px 0;
  width: 100%;
  word-wrap: break-word;
  word-break: break-all;
}
.lead-button-list {
  position: fixed;
  width: 60px;
  min-height: 100px;
  top: 81px;
  right: 50%;
  background-color: rgba(255, 255, 255, 1);
  border-radius: 2px;
  transform: translateX(560px);
}
.lead-button {
  width: 100%;
  height: 40px;
  border-bottom: 1px solid #eeeeee;
  font-size: 14px;
  line-height: 40px;
  cursor: pointer;
}

.focus-card {
  position: relative;
  border: 1px solid #dddddd;
  background-color: #fff;
  border-radius: 4px;
  margin: 20px 25px;
  z-index: 110;
}
.exersize-area {
  font-size: 14px;
}
.note-area .user-pic {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  overflow: hidden;
  float: left;
  background-color: #fff;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-end;
  border: 1px solid #ccc;
  position: absolute;
  left: 20px;
  top: 22px;
}

.user-pic img {
  width: 80%;
  height: 80%;
  // margin-bottom: -6px;
}
.user-msg {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0 8px 0;
}
.user-msg .name {
  font-weight: 600;
  font-size: 15px;
}

.comment-item {
  margin: 10px;
}
.zan {
  width: 40px;
  height: 20px;
  background: url("../assets/赞.png");
  background-size: 40%;
  background-repeat: no-repeat;
  text-align: right;
  color: #bfbfbf;
  font-size: 14px;
  padding-right: 4px;
  line-height: 18px;
  cursor: pointer;
}
.zan:hover {
  width: 40px;
  height: 20px;
  background: url("../assets/赞1.png");
  background-size: 40%;
  background-repeat: no-repeat;
  text-align: right;
  color: #8a8a8a;
}
.zaning {
  width: 40px;
  height: 20px;
  background: url("../assets/点赞.png");
  background-size: 40%;
  background-repeat: no-repeat;
  text-align: right;
  color: #1296db;
  font-size: 14px;
  padding-right: 4px;
  line-height: 18px;
  cursor: pointer;
}
.zaning:hover {
  width: 40px;
  height: 20px;
  background: url("../assets/点赞1.png");
  background-size: 40%;
  background-repeat: no-repeat;
  text-align: right;
  color: #1266db;
  font-size: 14px;
  padding-right: 4px;
  line-height: 18px;
  cursor: pointer;
}
.button-list {
  display: flex;
  justify-content: start;
  margin: 5px 0;
}
.button-list .font {
  font-size: 14px;
  color: #bfbfbf;
  padding-left: 20px;
}
.button-list .font:hover {
  color: #8a8a8a;
}
.reply {
  // width: 60px;
  height: 20px;
  background: url("../assets/回复.png");
  background-size: 20px 16px;
  background-repeat: no-repeat;
  text-align: right;
  color: #bfbfbf;
  font-size: 15px;
  padding-right: 4px;
  margin-left: 20px;
  cursor: pointer;
}
.reply:hover {
  // width: 60px;
  height: 20px;
  background: url("../assets/回复1.png");
  background-size: 20px 16px;
  background-repeat: no-repeat;
  text-align: right;
  color: #8a8a8a;
}
.comment-item .delete {
  width: 60px;
  height: 20px;
  background: url("../assets/删除.png");
  background-size: 30%;
  background-repeat: no-repeat;
  text-align: right;
  color: #bfbfbf;
  font-size: 15px;
  padding-right: 4px;
  margin-left: 20px;
  cursor: pointer;
}
.comment-item .delete:hover {
  width: 60px;
  height: 20px;
  background: url("../assets/删除1.png");
  background-size: 30%;
  background-repeat: no-repeat;
  text-align: right;
  color: #8a8a8a;
}

.reply-comment {
  display: flex;
  justify-content: space-between;
  margin: 10px 0 20px 0;
}
.space {
  padding: 5px 15px;
}
</style>
<template>
  <div style="padding-top: 58px" id="index">
    <div
      style="
        position: fixed;
        top: 0;
        width: 100%;
        min-width: 1210px;
        z-index: 100;
      "
    >
      <myheader
        v-on:js="toJS"
        v-on:wx="toWX"
        v-on:ydhlw="toYDHLW"
        v-on:wx_new="toWxNew"
      ></myheader>
    </div>
    
    <connect-us-vue v-if="showComt" @cancel="cancel"></connect-us-vue>
    <func-button-group
      :scrollTop="scrollTop"
      :list="buttonList1"
      v-if="$route.params.menu === undefined"
      @onClick="handleButtonClick"
    />
    <func-button-group
      :scrollTop="scrollTop"
      :list="buttonList2"
      v-if="$route.params.menu !== undefined"
      @onClick="handleButtonClick"
    />
    <div
      id="content"
      style="background-color: #fff; min-width: 1210px"
      v-if="$route.params.menu === undefined"
    >
      <!-- <div style="padding: 10px 30px">
        <my-breadcrumb :prop="breadcrumbList"></my-breadcrumb>
      </div> -->
      <div class="index-out">
        <div class="index-left">
          <div class="user-area">
            <div class="user-pic">
              <img
                class="avatar"
                :src="`../static/pic/avatars/${user.avatar}`"
                style="width: 100%; height: 100%"
                alt=""
              />
              <div class="change-avatar" @click="showChangeAvatar">
                更换头像
              </div>
            </div>
            <div class="flex-row" style="margin: 10px 0 0 59px">
              <div
                class="flex-column"
                style="text-align: left; font-size: 13px; width: 60px"
              >
                <div style="line-height: 24px">用户名：</div>
                <div style="line-height: 24px">权　限：</div>
              </div>
              <div
                class="flex-column"
                style="
                  text-align: left;
                  font-weight: 600;
                  margin-left: 10px;
                  width: 30px;
                "
              >
                <div class="username">
                  {{ user.username }}
                </div>
                <div style="line-height: 24px; font-size: 13px;width:100px">
                  {{
                    user.userGroup === "0"
                      ? "学生"
                      : user.userGroup == "1"
                      ? "超管"
                      : user.userGroup == "2"
                      ? "助教"
                      : "老师"
                  }}
                </div>
              </div>
            </div>
            <div class="user-list">
              <div v-for="(item, index) in userCenterList" :key="index">
                <div
                  class="user-list-bgc"
                  @click="toTarget(item.link)"
                  v-if="item.group.includes(user.userGroup)"
                >
                  <div class="user-list-item">{{ item.name }}</div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="index-center">
          <h1 class="title">课程资料</h1>
          <div style="padding: 15px 0 20px 0">
            <div
              class="index-card"
              v-for="(item, key) in class_list"
              :key="key"
              @click="toTarget(item.link)"
            >
              <div class="index-card-left">
                <img class="item-icon" :src="item.pic" />
                <div>{{ item.name }}</div>
              </div>
              <div class="index-card-right" v-text="item.text"></div>
            </div>
          </div>
          <div class="title-row">
            <div class="more" @click="ToMoreDemo">更多>></div>
            <h1 class="title">案例实践</h1>
          </div>
          <div style="padding: 15px 0 20px 0">
            <div
              class="index-card"
              v-for="(item, key) in demo_list"
              :key="key"
              @click="toDemoPractise(item.id)"
            >
              <div class="index-card-left">
                <img class="item-icon" :src="item.pic" />
                <div>{{ item.name }}</div>
              </div>
              <div class="index-card-right" v-text="item.text"></div>
            </div>
          </div>
        </div>
        <div class="index-right">
          <div class="homework-area">
            <div class="homework-btn" @click="toHomeWork">作业</div>
            <div class="homework" v-if="homeWorkList.length === 0">
              <h3>暂无进行中的作业</h3>
            </div>

            <div class="homework" v-if="homeWorkList.length !== 0">
              <h3>进行中作业:</h3>
              <div
                class="homework-list"
                v-for="(homework, index) in homeWorkList"
                :key="homework._id"
              >
                <h4 class="title">{{ homework.seq }}. {{ homework.name }}</h4>
                <div class="need" v-html="homework.need"></div>
                <div class="foot">
                  <span
                    class="time"
                    :title="`距离截止还有${formatRestTime(homework.rest_time)}`"
                    :style="
                      homework.rest_time / 1000 / 60 / 60 / 24 < 3
                        ? 'color:red'
                        : 'color:green'
                    "
                    >{{ formatRestTime(homework.rest_time) }}</span
                  >
                  <button
                    v-if="user.userGroup === '0' && homework.is_submit"
                    disabled
                    @click="doHomework(index)"
                  >
                    已完成
                  </button>
                  <button
                    v-if="user.userGroup === '0' && !homework.is_submit"
                    @click="doHomework(index)"
                  >
                    去完成
                  </button>
                  <div class="flex-row" v-else-if="user.userGroup !== '0'">
                    <img
                      :title="`已交 ${homework.submit_num} 人`"
                      src="../../static/pic/已交.png"
                    />
                    <p :title="`已交 ${homework.submit_num} 人`">
                      {{ homework.submit_num }}
                    </p>
                    <img
                      :title="`未交 ${
                        homework.stu_num - homework.submit_num
                      } 人`"
                      src="../../static/pic/未交.png"
                    />
                    <p
                      :title="`未交 ${
                        homework.stu_num - homework.submit_num
                      } 人`"
                    >
                      {{ homework.stu_num - homework.submit_num }}
                    </p>
                  </div>
                </div>
              </div>
            </div>
          </div>

          <!-- <div class="item-card" v-for="(items, index) in index_list_right" :key="index">
            <div class="item-title">
              {{ items.type }}
            </div>
            <div class="item-padding-bottom">
              <span v-for="item in items.item" :key="item.name">
                <span class="item-small-right" v-if="item.userGroup === undefined || item.userGroup.includes(userGroup)" @click="toTarget(item.link)">
                  <img  class="item-icon" :src="item.pic"/>
                  <div class="name"> {{ item.name }} </div>
                </span>
              </span>
            </div>
            
            
          </div> -->
        </div>
      </div>
    </div>
    <div
      v-if="$route.params.menu !== undefined"
      v-loading="loading"
      style="min-width: 1210px; background-color: white"
      id="content"
    >
      <div style="padding: 15px 30px">
        <my-breadcrumb :prop="breadcrumbList2"></my-breadcrumb>
      </div>
      <div class="flex-row">
        <div class="menu">
          <div>
            <my-own-menu
              :menu="menu"
              @handleMenuClick="handleMenuClick"
            ></my-own-menu>
          </div>
        </div>
        <Layout id="layout-point" style="position: relative; width: 80%">
          <Content
            id="point-content"
            v-if="$route.params.menu !== undefined && !viewFlag"
            style="minheight: 280px; background: #fff"
            class="list out"
            :key="+new Date()"
          >
            <div
              class="block pageIndex"
              v-if="content.length > 0 && !viewFlag && content.length !== 0"
            >
              <span class="demonstration point"
                >知识点
                <div class="el-tooltip item el-pagination is-background">
                  <button
                    class="btn-prev"
                    :disabled="currentPage === 1 ? true : false"
                    @click="pageDown"
                  >
                    <i class="el-icon el-icon-arrow-left"></i>
                  </button>
                  <ul class="el-pager" v-for="i in content.length" :key="i">
                    <el-tooltip
                      class="item"
                      effect="dark"
                      :content="pointtitle"
                      placement="bottom"
                    >
                      <li
                        class="number"
                        :class="currentPage === i ? 'active' : ''"
                        @mouseover="handleCurrentMouseover(i)"
                        @click="handleCurrentChange(i)"
                      >
                        {{ i }}
                      </li>
                    </el-tooltip>
                  </ul>
                  <button
                    class="btn-prev"
                    :disabled="currentPage === content.length ? true : false"
                    @click="pageUp"
                  >
                    <i class="el-icon el-icon-arrow-right"></i>
                  </button>
                </div>
              </span>
            </div>

            <div
              v-if="
                (userGroup === '1' || userGroup === '3') && content.length === 0
              "
              @click="toPoint0"
            >
              <Icon
                class="el-icon-circle-plus-outline"
                style="color: #36a1e3"
                size="20"
              />
              <a style="font-size: 17px">在这里添加一个知识点</a>
            </div>

            <div v-if="content.length !== 0" style="width: 100%">
              <div
                class="pointview-area"
                v-for="(point, index) in content"
                :key="index"
              >
                <div
                  class="card"
                  style="margin-bottom: 40px"
                  v-if="index === showPoint"
                >
                  <div class="card_row">
                    <el-tooltip
                      v-if="showpathFlag && userGroup !== '0' && content.length"
                      class="item"
                      effect="dark"
                      :content="pathSaveTip"
                      placement="bottom-end"
                    >
                      <Icon
                        class="el-icon-s-claim"
                        size="30"
                        @click="pathlistOrEdit ? addToPathBtn(index) : ''"
                        :style="
                          pathsaved !== -1 ? 'color:#409EFF' : 'color:#2C3E50'
                        "
                      ></Icon>
                    </el-tooltip>

                    <Card class="card_item">
                      <div slot="title">
                        <!-- <Icon
                              type="md-checkmark"
                              v-if="(showPro===0 || (showPro===1 && showIndex>=index))"
                            /> -->
                        {{ index + 1 }}、
                        <span
                          draggable="true"
                          @drag="dragstart(index)"
                          @dragend="dragendfun"
                          >{{ point.title }}</span
                        >

                        <!-- <p v-if="point.bloom === 1">(布鲁姆认知层次：记忆)</p>
                            <p v-if="point.bloom === 2">(布鲁姆认知层次：理解)</p>
                            <p v-if="point.bloom === 3">(布鲁姆认知层次：应用)</p>
                            <p v-if="point.bloom === 4">(布鲁姆认知层次：分析)</p>
                            <p v-if="point.bloom === 5">(布鲁姆认知层次：综合)</p>
                            <p v-if="point.bloom === 6">(布鲁姆认知层次：评价和创造)</p> -->
                      </div>
                      <!-- <a
                            slot="extra"
                            style="margin-right: 30px"
                            @click="doExercise(index, showIndex<index?1:0)"
                            :disabled="canPro===0||(canPro===2 && index>=showIndex+2)"
                          >做题</a> -->
                      <!-- <a
                            slot="extra"
                            style="margin-right: 30px"
                            @click="doExercise(index, showIndex<index?1:0)"
                            v-if="userGroup === '0'"
                          >做题</a> -->
                      <!-- <a
                            slot="extra"
                            style="margin-right: 30px"
                            @click="toAllQuestion(index)"
                            v-if="userGroup !== '0'"
                            >题库</a> -->
                      <!-- <a slot="extra" style="margin-right: 15px" @click="allAnswer(index)">讨论</a> -->

                      <div v-html="point.content" class="point-content"></div>
                      <!-- <div class="box">
                            <a
                              v-if="($route.params.menu == 'js,2,1' || $route.params.menu == 'js,3,1') && index == content.length-1"
                              style="color: green; font-size: 15px;"
                              @click="toOnlineCoding(index, $route.params.menu)"
                            >练习一下</a>
                          </div> -->
                    </Card>
                  </div>
                </div>
                <div
                  style="width: 25%; margin-top: 70px"
                  v-if="index === showPoint"
                >
                  <div class="right_side" v-if="index === showPoint">
                    <div
                      class="point-button"
                      @click="toAllQuestion(index)"
                      v-if="userGroup !== '0'"
                    >
                      题库
                    </div>
                    <div
                      class="point-button"
                      @click="doExercise(index, showIndex < index ? 1 : 0)"
                      v-if="userGroup === '0'"
                    >
                      做题
                    </div>
                    <div class="point-button" @click="allAnswer(index)">
                      问答
                    </div>
                    <div
                      class="point-button"
                      v-if="
                        userGroup === '1' ||
                        userGroup === '2' ||
                        userGroup === '3'
                      "
                      @click="editPoint(point._id, point.seq, index)"
                    >
                      编辑此知识点
                    </div>
                    <div
                      class="point-button"
                      v-if="
                        userGroup === '1' ||
                        userGroup === '2' ||
                        userGroup === '3'
                      "
                      @click="giveQuestion(point.seq, point._id)"
                    >
                      为知识点出题
                    </div>
                    <!-- <div
                          class="point-button"
                          v-if="userGroup === '1'"
                          @click="more_point(point.seq, point._id)"
                        >
                          添加更多内容
                        </div> -->
                    <div
                      class="point-button"
                      v-if="
                        index === showPoint &&
                        (userGroup === '1' || userGroup === '3')
                      "
                      @click="toPoint(point.seq)"
                      title="在此知识点之后添加一个新知识点"
                    >
                      添加新知识点
                    </div>
                    <div
                      v-if="userGroup === '1' || userGroup === '3'"
                      class="point-button"
                      style="color: red"
                      @click="deleteThisPoint(point._id, index)"
                    >
                      删除此知识点
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <!--<Button type="primary" class="allquestion" v-if="show" @click="allquestion">套题</Button>-->
            <!-- <div >
                  <el-tag
                    v-for="tag in tags"
                    :key="tag.name"
                    closable
                    :type="tag.type">
                    <div></div>
                    {{tag.name}}
                  </el-tag>
                </div> -->
          </Content>

          <Content
            id="point-content"
            v-if="$route.params.menu !== undefined && viewFlag"
            style="minheight: 280px; background: #fff; overflow: auto"
          >
            <div
              id="wordview"
              class="wordview-container"
              v-if="content.length > 0"
              @mouseover="hoveredPointEnd"
            >
              <div
                :id="`word-point${point._id}`"
                :style="canFocus ? '' : 'pointer-events: none'"
                @mouseover.stop="hoveredPoint(point._id)"
                :class="hoveringId === point._id ? 'hovering' : ''"
                class="word-point"
                v-for="(point, index) in content"
                :key="index"
                title="双击空白部分可以显示更多哦~"
                @dblclick="focusOpen(index)"
              >
                <div class="flex-space-between">
                  <h2 class="title">{{ index + 1 }}、{{ point.title }}</h2>
                  <div class="show-more" title="单击图标可以显示更多内容哦~" v-if="hoveringId === point._id" @click.stop="focusOpen(index)"> 
                    <icon class="el-icon-menu icon" size="18"/>
                  </div>
                </div>
                <div class="content" v-html="point.content"></div>
              </div>
              <div class="content-foot">
                <span class="pre" @click="toPreOrNext(preSection.link)" v-if="preSection.name!==''">
                  <icon class="el-icon-back" size="20" />
                  <p>{{ preSection.name }}</p>
                </span>
                <span class="next" @click="toPreOrNext(nextSection.link)" v-if="nextSection.name!==''">
                  <p>{{ nextSection.name }}</p>
                  <icon class="el-icon-right" size="20" />
                </span>
              </div>
            </div>
          </Content>

          <!-- <div class="path-btn" v-if="!viewFlag" @click="showpath" style="cursor: pointer;" :style="showpathFlag?'right:182px':'right:19px'">
                <span v-if="!showpathFlag" class="column-one">
                  推荐路径
                </span>
                <span v-if="showpathFlag" style="line-height:48px;" class="el-dropdown-link">
                  收起
                </span>
              </div> -->
          <div
            id="pathout"
            v-if="content.length > 0 && showpathFlag"
            class="path-outside"
            style="height: 97.5%"
          >
            <div
              id="path"
              v-if="
                (userGroup !== '0' && pathlistOrEdit) ||
                (userGroup === '0' && !pathlistOrEdit)
              "
              class="path"
              @dragleave.prevent="dropdragleave($event)"
              @dragover.prevent="dropdrag2($event)"
            >
              <el-dropdown
                v-if="showpathFlag && userGroup === '0'"
                @command="handleCommand"
                class="el-dropdown-link path-name-list"
                style="cursor: pointer; position: absolute"
              >
                <span>
                  {{ nowpathName }}
                  <i class="el-icon-arrow-down el-icon--right"></i>
                </span>
                <el-dropdown-menu slot="dropdown">
                  <div v-for="(item, index) in pathlist" :key="index">
                    <el-dropdown-item :command="index">{{
                      item.pathName
                    }}</el-dropdown-item>
                  </div>
                </el-dropdown-menu>
              </el-dropdown>
              <span
                class="path-top-btn"
                @click="savepath"
                v-if="showpathFlag && userGroup !== '0'"
                style="left: 1px; cursor: pointer"
              >
                保存路径
              </span>
              <span
                class="path-top-btn"
                @click="canceladdnewpath"
                v-if="showpathFlag && userGroup !== '0'"
                style="right: 1px; cursor: pointer"
              >
                取消
              </span>
              <div
                v-if="JSON.parse(tags).length === 0 && userGroup !== '0'"
                class="path-tip"
              >
                拖拉知识点标题到此区域中，绘制个性化学习路径吧~~~
              </div>
              <div
                v-if="JSON.parse(tags).length === 0 && userGroup === '0'"
                class="path-tip"
              >
                暂无推荐路径
              </div>
              <div class="tag-box" id="pathbox">
                <span
                  v-for="(item, index) in JSON.parse(tags).slice(
                    pathpage * tagnumber,
                    (pathpage + 1) * tagnumber
                  )"
                  :key="index"
                  :id="index + pathpage * tagnumber"
                  :title="item.content.title"
                  class="el-tag el-tag--light tag"
                  @dragover.prevent="dropdrag($event)"
                  style="margin-bottom: 5px"
                  draggable="true"
                  @drag.prevent="dragstart2(index + pathpage * tagnumber)"
                  @dragend.prevent="dragendfun"
                  @click.prevent="toPage(item)"
                >
                  <span style="width: 100px; clear: both">
                    {{ item.title }}
                  </span>
                  <i
                    v-if="userGroup !== '0'"
                    class="tag-close el-tag__close el-icon-close"
                    @click="deltag(item.content._id, $event)"
                  ></i>
                </span>
              </div>
              <div class="el-tooltip path-item el-pagination is-background">
                <button
                  class="btn-prev"
                  :disabled="pathpage === 0 ? true : false"
                  @click="pathpagedown"
                >
                  <i class="el-icon el-icon-arrow-left"></i>
                </button>
                <span class="pathpage-number">{{ pathpage + 1 }}</span>
                <button
                  class="btn-prev"
                  :disabled="
                    pathpage ===
                    parseInt((JSON.parse(tags).length - 1) / tagnumber)
                      ? true
                      : false
                  "
                  @click="pathpageup"
                >
                  <i class="el-icon el-icon-arrow-right"></i>
                </button>
              </div>
            </div>
            <div v-if="userGroup !== '0' && !pathlistOrEdit" class="path">
              <div class="path-top" style="cursor: pointer" @click="addnewpath">
                添加学习路径
              </div>
              <div class="pathname-list">
                <span
                  class="el-tag el-tag--light tag"
                  style="margin-bottom: 5px"
                  v-for="(item, index) in pathCreatedList"
                  :key="index"
                >
                  <span style="width: 100px; clear: both">
                    {{ item.pathName }}
                  </span>
                  <i
                    class="el-icon-delete path-item-icon"
                    @click="delpath(item._id)"
                    title="删除此路径"
                  ></i>
                  <i
                    class="el-icon-edit path-item-icon"
                    @click="editpath(index)"
                    title="编辑此路径"
                  ></i>
                </span>
              </div>
            </div>
          </div>
        </Layout>
      </div>
    </div>
    <div v-if="focusPoint" class="mask-layer">
      <div id="word-point" class="word-point focus-point">
        <div style="padding: 25px" class="focus-card">
          <h2 class="title">
            {{ focusingIndex + 1 }}、{{ content[focusingIndex].title }}
          </h2>
          <div
            class="point-content"
            v-html="content[focusingIndex].content"
          ></div>
        </div>
        <div class="note-area">
          <div id="note" class="item-header">
            <span> {{ noteList.length }} 篇笔记</span>
            <div class="add-note-button" @click="addNote">
              <img class="note-icon" src="../../static/pic/note.png" />
              添加笔记
            </div>
          </div>
          <div
            class="focus-card"
            style="font-size: 15px; text-align: center; padding: 20px 0"
            v-if="noteList.length === 0 && addNoteFlag === false"
          >
            本知识点尚未添加任何笔记~
          </div>
          <div
            v-for="(item, index) in noteList"
            :key="index"
            class="focus-card"
          >
            <span class="user-pic">
              <img
                :src="`../static/pic/avatars/${
                  item.avatar ? item.avatar : '头像3.svg'
                }`"
                alt="头像"
              />
            </span>
            <div class="note-item" style="margin-left: 50px">
              <div class="user-msg">
                <div class="name">{{ item.username }}</div>
                <div class="time">{{ formatDate(item.time) }}</div>
              </div>

              <div class="note" v-html="item.note"></div>
              <div v-if="userGroup==='1'" class="del-note">
                <a @click.prevent="delNote(item._id)">删除</a>
              </div>
              
            </div>
          </div>

          <div
            id="add-note"
            class="note-edit"
            style="padding-bottom: 50px"
            v-show="addNoteFlag"
          >
            <div style="font-size: 16px; font-weight: 600; padding: 8px 0">
              添加笔记
            </div>
            <div
              ref="note"
              style="font-size: 16px; text-align: left; background-color: white"
            ></div>
            <!-- <button class="share-note">分享笔记</button> -->
            <el-button
              style="float: right; margin-top: 15px"
              @click="shareNote"
              type="primary"
              >分享笔记</el-button
            >
          </div>
        </div>

        <div
          class="comment-area"
          style="min-height: 50px; width: 100%; margin: 20px 0"
        >
          <div id="comment" class="item-header">
            <!-- <img class="note-icon" src="../../static/pic/note.png"/> -->
            <span>提问</span>
            <div class="add-note-button" @click="addComment">
              <img class="note-icon" src="../../static/pic/note.png" />
              发起提问
            </div>
          </div>
          <comment :point="content[this.focusingIndex]" ref="comment"></comment>
        </div>
        <div
          class="exersize-area"
          style="min-height: 50px; width: 100%; margin: 20px 0"
        >
          <div id="doexersize" class="item-header">
            <!-- <img class="note-icon" src="../../static/pic/note.png"/> -->
            做题
          </div>
          <div class="focus-card" style="padding: 20px">
            <div
              class="exersize-card"
              v-for="(items, key) in questionList"
              :key="key"
            >
              <div class="flex-row">
                <span
                  style="background-color: white; font-size: 30px; margin: 0"
                  :class="
                    collectionFlagList[key]
                      ? 'el-icon-star-on'
                      : 'el-icon-star-off'
                  "
                  @click="collect(key)"
                ></span>
                <div style="margin: 0 0 0 15px;width: 100%">
                  <div class="flex-row">
                    <p>{{ key + 1 }}、</p>
                    <p v-if="items.bloom === 1">(布鲁姆认知层次：记忆)</p>
                    <p v-if="items.bloom === 2">(布鲁姆认知层次：理解)</p>
                    <p v-if="items.bloom === 3">(布鲁姆认知层次：应用)</p>
                    <p v-if="items.bloom === 4">(布鲁姆认知层次：分析)</p>
                    <p v-if="items.bloom === 5">(布鲁姆认知层次：综合)</p>
                    <p v-if="items.bloom === 6">(布鲁姆认知层次：评价和创造)</p>
                  </div>
                  <div style="margin: 10px 0" v-html="items.question"></div>

                  <myradio
                    v-if="items.type === 'panduan'"
                    :attachment="key === 0"
                    :point="content[focusingIndex]"
                    :ques="items"
                  />
                  <mycheckbox
                    v-if="items.type === 'xuanze'"
                    :attachment="key === 0"
                    :point="content[focusingIndex]"
                    :ques="items"
                  />
                  <myeditor
                    v-if="items.type === 'jianda'"
                    :attachment="key === 0"
                    :pointId="content[focusingIndex]._id"
                    :quesId="items._id"
                  />
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="lead-button-list">
        <div class="lead-button" style="color: #d30000" @click="exitFocus">
          退出
        </div>
        <div class="lead-button" @click="scrollTo('word-point')">知识点</div>
        <div class="lead-button" @click="scrollTo('note')">笔记</div>
        <div class="lead-button" @click="scrollTo('comment')">提问</div>
        <div class="lead-button" @click="scrollTo('doexersize')">做题</div>
      </div>
    </div>
    <el-dialog
      title="提示"
      v-if="!wordViewGuide"
      :before-close="closeGuide"
      :visible="true"
      :modal="true"
      width="40%"
    >
      <div
        style="
          display: flex;
          justify-content: flex-start;
          padding: 0 10px;
          text-align: left;
        "
      >
        点击文档中的知识点区域，可以显示关于该知识点的更多内容！
      </div>
      <!-- <div style="display: flex;justify-content: flex-start;padding: 40px 20px 20px">
        
      </div> -->
      <div
        style="
          display: flex;
          justify-content: space-between;
          align-items: center;
          margin-top: 40px;
          padding: 0 10px;
        "
      >
        <el-checkbox v-model="notShowMessage">不再提示此消息</el-checkbox>
        <el-button type="primary" @click="guideFinish">确定</el-button>
      </div>
    </el-dialog>
    <el-dialog
      title="保存推荐路径"
      v-if="showPathSave"
      :visible="true"
      :show-close="false"
      :modal="true"
      width="40%"
    >
      <div class="recommend-type-title recommend-type">
        <p>路径名称：</p>
        <el-input
          class="recommend-title"
          style="position: absolute; left: 70px; top: -9px; width: 252px"
          v-model="pathName"
          placeholder="路径名称"
        ></el-input>
        <p class="recommend-type-title-flags" style="margin-top: 45px">
          请选择推荐面向群体：
        </p>
        <span class="recommend-group">
          <el-select
            v-model="flags"
            filterable
            multiple
            placeholder="请选择"
            style="margin-left: 20px"
          >
            <el-option-group
              v-for="group in options"
              :key="group.label"
              :label="group.label"
            >
              <el-option
                v-for="item in group.options"
                :key="item.value"
                :label="item.label"
                :value="item.label"
              ></el-option>
            </el-option-group>
          </el-select>
        </span>
        <p class="recommend-type-title" style="margin-top: 87px">学习路径：</p>
      </div>
      <div class="recommend-content">
        <div v-for="(item, index) in JSON.parse(tags)" :key="index">
          {{ item.content.title }}
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="showPathSave = false">取消</el-button>
        <el-button type="primary" @click="PathSave">保存</el-button>
      </span>
    </el-dialog>
    <avatars v-if="showAvatarFlag" @handleclose="closeAvatars" />
    <message-box v-if="showDelNoteConfirm" :options="delNoteConfirmOptions"  @cancel="cancelDelNote" @confirm="confirmDelNote"/>
  </div>
</template>

<script>
import myheader from "../components/header.vue";
import myOwnMenu from "../components/myOwnMenu.vue";
import myradio from "../components/myradio.vue";
import comment from "../components/comment.vue";
import myeditor from "../components/myeditor.vue";
import connectUs from "../components/connectUs.vue";
import mycheckbox from "../components/mycheckbox.vue";
import funcButtonGroup from "../components/funcButtonGroup.vue";
import myBreadcrumb from "../components/myBreadcrumb.vue";
import avatars from "../components/avatars.vue";
import messageBox from "../components/message_box.vue"
import { debounce } from "../utils/debounce"

import E from "wangeditor";
import {
  get_index_homework,
  collect_pro,
  getCollectionFlags,
  getAllQuestions,
  get_notes,
  add_note,
  add_wordviewFlag,
  get_wordviewFlag,
  getMenu,
  getContent,
  deletePoint,
  getlearn_process,
  add_PointProcess,
  add_learnpath,
  getLearnPath,
  getCreateLearnPath,
  updateLearnPath,
  deleteLearnPath,
  delete_note
} from "../api/api";

export default { 
  name: "index",
  data: function () {
    return {
      options: [
        {
          label: "身份标签",
          options: [
            {
              value: "0",
              label: "学生",
            },
            {
              value: "1",
              label: "管理员",
            },
            {
              value: "2",
              label: "助教",
            },
            {
              value: "3",
              label: "老师",
            },
          ],
        },
        {
          label: "学年",
          options: [
            {
              value: "4",
              label:
                new Date().getFullYear() -
                2 +
                "--" +
                (new Date().getFullYear() - 1),
            },
            {
              value: "5",
              label:
                new Date().getFullYear() - 1 + "--" + new Date().getFullYear(),
            },
            {
              value: "6",
              label:
                new Date().getFullYear() +
                "--" +
                (new Date().getFullYear() + 1),
            },
          ],
        },
        {
          label: "课程",
          options: [
            {
              value: "7",
              label: "导论课",
            },
            {
              value: "8",
              label: "本科创新创业选修课",
            },
            {
              value: "9",
              label: "研究生创新创业课",
            },
            {
              value: "10",
              label: "移动互联网创意与创业课",
            },
          ],
        },
        {
          label: "组别",
          options: [
            {
              value: "11",
              label: "做题组",
            },
            {
              value: "12",
              label: "非做题组",
            },
          ],
        },
      ],
      class_list: [
        {
          pic: "../../static/pic/移动互联网.png",
          name: "移动互联网",
          link: "ydhlw,0,0",
          text: `介绍了设计中常用的四个设计工具，介绍了系统探索学习法。`,
        },
        {
          pic: "../../static/pic/Java-Script.png",
          name: "JavaScript",
          link: "js,0,0",
          text:
            "JavaScript 是 Web 中的编程语言。本教程是小程序学习中需要的 JavaScript 基础。",
        },
        {
          pic: "../../static/pic/小程序.png",
          name: "微信小程序",
          link: "wx,0,0",
          text: "通过对小程序的文件结构和示例代码讲解快速入门小程序和云开发。",
        },
        // {
        //   pic: "../../static/pic/微信小程序.png",
        //   name: "微信小程序教程",
        //   link: "wx_new,0,0",
        //   text: "通过对小程序的文件结构和示例代码讲解快速入门小程序和云开发。",
        // },
      ],
      demo_list: [
        {
          pic: "../../static/pic/购物车.png",
          name: "淘宝购物车",
          id: "5e994d4c99d94c6377e4cfa5",
          text: `一个具有添加商品、计算价格功能的简单购物车案例。`,
        },
        {
          pic: "../../static/pic/相册.png",
          name: "简单相册",
          id: "5e985ea25dfa19720e7d865a",
          text: `通过使用列表组件(li)和图片组件(img)制作的相册。`,
        },
        {
          pic: "../../static/pic/密码.png",
          name: "密码生成器",
          id: "5ea11ae608471f5a44897f6e",
          text: `按照指定的长度、大小写等要求快速生成随机密码的简单案例。`,
        },
        {
          pic: "../../static/pic/计算器.png",
          name: "简单计算器",
          id: "5ea120e308471f5a44897f70",
          text: `通过 JavaScript、Css 和 HTML 实现一个简单的计算器功能。`,
        },
      ],
      index_list_right: [
        {
          type: "学习工具",
          item: [
            {
              pic: "../../static/pic/收藏夹.png",
              name: "收藏夹",
              link: "collection",
            },
            {
              pic: "../../static/pic/错题本.png",
              name: "错题本",
              link: "error",
            },
            {
              pic: "../../static/pic/笔记本.png",
              name: "笔记本",
              link: "ydhlw,0,0",
            },
            {
              pic: "../../static/pic/学习路径 (1).png",
              name: "我的路径",
              link: "path",
              userGroup: ["0"],
            },
          ],
        },
        {
          type: "教学工具",
          // userGroup: '2',
          item: [
            {
              pic: "../../static/pic/题库.png",
              name: "题库",
              link: "demoPractise",
            },
            {
              pic: "../../static/pic/数据分析.png",
              name: "数据分析",
              link: "analyse",
            },
            {
              pic: "../../static/pic/学习路径 (1).png",
              name: "路径查询",
              link: "path",
              userGroup: ["1", "2", "3"],
            },
          ],
        },
      ],
      userCenterList: [
        {
          name: "个人中心",
          group: ["0", "1", "2", "3"],
          link: "person",
        },
        {
          name: "权限审核",
          group: ["1"],
          link: "check",
        },
        {
          name: "权限分配",
          group: ["1"],
          link: "appoint",
        },
        {
          name: "用户反馈",
          group: ["1", "2", "3"],
          link: "feedback",
        },
        {
          name: "数据分析",
          group: ["1", "3"],
          link: "analyse",
        },
        {
          name: "我的收藏",
          group: ["0", "1", "2", "3"],
          link: "collection",
        },
        {
          name: "我的路径",
          group: ["0"],
          link: "path",
        },
        {
          name: "路径查询",
          group: ["1", "2", "3"],
          link: "path",
        },
        {
          name: "错题本",
          group: ["0", "1", "2", "3"],
          link: "error",
        },
        {
          name: "权限申请",
          group: ["0"],
          link: "apply",
        },
      ],
      buttonList1: [
        {
          name: "goTop",
          title: "顶部",
          back: "回到顶部",
          icon: "el-icon-arrow-up",
        },
        {
          name: "connectUs",
          title: "反馈",
          back: "联系我们",
          icon: "el-icon-service",
        },
      ],
      buttonList2: [
        {
          name: "goTop",
          title: "顶部",
          back: "回到顶部",
          icon: "el-icon-arrow-up",
        },
        {
          name: "tapView",
          title: "视图",
          back: "切换视图",
        },
        {
          name: "connectUs",
          title: "反馈",
          back: "联系我们",
          icon: "el-icon-service",
        },
      ],
      breadcrumbList: [
        {
          name: "首页",
          blod: true,
        },
      ],
      tags: "",
      active: "0-0",
      openNames: [],
      menu: [],
      content: [],
      showPoint: 0,
      userGroup: "",
      show: true,
      process: sessionStorage.process,
      left_process: sessionStorage.left_process,
      showIndex: -1,
      showPro: -1,
      canPro: -1,
      mymenu: sessionStorage.mymenu,
      allMenu: [],
      isLast: false,
      currentPage: 1,
      showComt: false,
      pointtitle: "",
      dragcontent: {}, //被拖拽元素内容
      lastDrag: 0, //上次拖拽位置（未松开）
      sameDrag: 0, //标记是否是同一次拖拽
      showpathFlag: false,
      flags: [], //推荐路径标签
      showPathSave: false,
      pathName: "",
      nowpathName: "请选择推荐路径",
      pathlist: [],
      pathpage: 0,
      pathsaved: -1,
      tagnumber: 15,
      pathlistOrEdit: false,
      pathCreatedList: [],
      editingId: "",
      viewFlag: 1,
      focusPoint: false,
      focusedPoint: 0,
      showmorePointMsgflag: false,
      timer: null,
      firstUpdate: true,
      wordViewGuide: true,
      notShowMessage: false,
      hoveringId: "",
      canFocus: true,
      focusingIndex: -1,
      loading: false,
      addNoteFlag: false,
      local_date: "",
      editorContent: "",
      noteList: [],
      questionList: [],
      collectionFlagList: [],
      quesCollectionIdList: [],
      homeWorkList: [],
      scrollTop: 0,
      showAvatarFlag: false,
      preSection: {
        name: '',
        link: ''
      },
      nextSection: {
        name: '',
        link: ''
      },
      showDelNoteConfirm: false,
      delNoteConfirmOptions:{
        title: '提示',
        content: '是否要永久删除该条笔记？',
        cancel: '取消',
        confirm: '确定'
      },
      deleteNoteId: ''
    };
  },
  computed: {
    pathSaveTip: function () {
      if (!this.pathlistOrEdit) {
        return "未选择推荐路径";
      }
      return this.pathsaved === -1
        ? "该题未加入当前推荐路径"
        : "该题已被加入当前所选推荐路径";
    },
    user: function () {
      return JSON.parse(this.$store.state.user);
    },
    breadcrumbList2(){
      let page = this.$route.path.split(",")[0].slice(1);
      switch (page) {
        case "ydhlw":
          return [
            {
              name: "首页",
              blod: true,
              to: "index"
            },
            {
              name: "移动互联网",
              to: "ydhlw,0,0",
            },
          ];
        case "js":
          return [
            {
              name: "首页",
              blod: true,
              to: "index"
            },
            {
              name: "JavaScript",
              to: "js,0,0",
            },
          ];
        case "wx":
          return [
            {
              name: "首页",
              blod: true,
              to: "index"
            },
            {
              name: "微信小程序",
              to: "wx,0,0",
            },
          ];
        case "wx_new":
          return [
            {
              name: "首页",
              blod: true,
              to: "index"
            },
            {
              name: "微信小程序教程",
              to: "wx_new,0,0",
            },
          ];
          
      }
    },
    current_url(){
      return this.$route.path
    }
  },
  watch: {
    current_url: function(val){
      this.showComt = false;
      if(this.focusPoint){
        this.exitFocus();
      }
    }
  },
  created() {
    if (JSON.parse(sessionStorage.getItem("pointPage")) != null) {
      this.currentPage = JSON.parse(sessionStorage.getItem("pointPage"));
    } else {
      this.currentPage = 1;
    }
    this.showPoint = this.currentPage - 1;
    if (JSON.parse(sessionStorage.getItem("learnpath")) != null) {
      this.tags = sessionStorage.getItem("learnpath");
    } else {
      let list = [];
      this.tags = JSON.stringify(list);
    }
    if (this.$route.query.showPoint) {
      this.showPoint = parseInt(this.$route.query.showPoint);
      this.currentPage = this.showPoint + 1;
    }
    // 获取视图模式
    if (JSON.parse(sessionStorage.getItem("viewFlag")) != null) {
      this.viewFlag = JSON.parse(sessionStorage.getItem("viewFlag"));
    }
  },
  mounted() {
    let that = this;
    window.addEventListener('scroll', debounce(function(e){
      that.scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
    }, 50, false))
    window.onresize = () => {
      return (() => {
        if (document.getElementById("pathbox") !== null) {
          setTimeout(() => {
            let pathBoxHeight = document.getElementById("pathbox").clientHeight;
            this.tagnumber = parseInt(pathBoxHeight / 35);
          }, 100);
        }
      })();
    };

    document.addEventListener('keyup', this.handleEscClick);  // 监听esc按键

    this.userGroup = JSON.parse(this.$store.state.user).userGroup;
    if (this.mymenu) {
      this.mymenu = sessionStorage.mymenu;
    } else {
      this.mymenu = 0;
    }
    if (this.left_process) {
      this.left_process = sessionStorage.left_process.split(",");
    } else {
      this.left_process = [];
    }
    if (this.process) {
      this.process = sessionStorage.process.split("&");
    } else {
      this.process = [];
    }
    this.update_content();
    let getHomeworkListJson = {};
    if (this.userGroup === "0") {
      let flags = this.user.flags;
      flags.push("学生");
      get_index_homework({
        flags: flags,
        stu_UUID: this.user.UUID,
      }).then((res) => {
        if (res.state) {
          this.homeWorkList = res.homeworks;
        }
      });
    } else {
      get_index_homework({
        UUID: this.user.UUID,
      }).then((res) => {
        if (res.state) {
          this.homeWorkList = res.homeworks;
        }
      });
    }
    
  },
  beforeDestroy(){
    document.removeEventListener('keyup', this.handleEscClick);
  },
  components: {
    myheader: myheader,
    connectUsVue: connectUs,
    comment,
    myeditor,
    myradio,
    mycheckbox,
    avatars,
    "my-own-menu": myOwnMenu,
    "func-button-group": funcButtonGroup,
    "my-breadcrumb": myBreadcrumb,
    "message-box": messageBox
  },
  methods: {
    delNote(id){
      this.showDelNoteConfirm=true;
      this.deleteNoteId = id;
    },
    cancelDelNote(){
      this.showDelNoteConfirm=false;
    },
    confirmDelNote(){
      delete_note({
        id: this.deleteNoteId
      }).then(res => {
        if(res.state = true){
          this.$Message.success("删除笔记成功！")
          this.getNoteList();
          this.showDelNoteConfirm=false;
          return
        }
        this.$Message.error(res.msg)
      }).catch(err => {
        this.$Message.error("删除笔记失败" +err.status);
      })
    },
    handleEscClick(e){
      if(e.keyCode===27){
        this.exitFocus();
      }
    },
    closeAvatars() {
      this.showAvatarFlag = false;
    },
    showChangeAvatar() {
      this.showAvatarFlag = true;
    },
    doHomework(index) {
      if (this.homeWorkList[index].type === "timu") {
        sessionStorage.setItem(
          "homework_seq",
          JSON.stringify({
            seq: this.homeWorkList[index].seq,
          })
        );
        this.$router.push({
          name: "doHomework",
        });
      } else {
        sessionStorage.setItem(
          "homework_seq",
          JSON.stringify({
            seq: this.homeWorkList[index].seq,
          })
        );
        this.$router.push({
          name: "normalHomework",
        });
      }
    },
    formatRestTime(time) {
      let days = time / 1000 / 60 / 60 / 24;
      if (days >= 1) return ` ${parseInt(days)} 天`;
      let hours = time / 1000 / 60 / 60;
      if (hours >= 1) return `${parseInt(hours)} 小时`;
      let mins = time / 1000 / 60 / 60;
      return `${parseInt(mins)} 分钟`;
    },
    handleButtonClick(data) {
      let scrollEle = document.getElementById("point-content");
      switch (data) {
        case "goTop":
          document.documentElement.scrollTop = document.body.scrollTop = 0;
          return;
        case "tapView":
          if (this.viewFlag) this.tabToPointView();
          else this.tabToWordView();
          return;
        case "connectUs":
          this.connectUs();
          return;
      }
    },
    collect(key) {
      let json = null;
      if (this.collectionFlagList[key]) {
        if (key === 0) {
          json = {
            attachment: true,
            question_ID: this.content[this.focusingIndex]._id,
            UUID: this.user.UUID,
            cancel: true,
          };
        } else {
          json = {
            attachment: false,
            question_ID: this.questionList[key]._id,
            UUID: this.user.UUID,
            cancel: true,
          };
        }
        collect_pro(json)
          .then((response) => {
            if (response.state === true) {
              this.getCollection(this.quesCollectionIdList);
            } else {
              this.$Message.error(response.msg);
            }
          })
          .catch((error) => {
            this.$Message.error("获取收藏状态失败");
          });
      } else {
        if (key === 0) {
          json = {
            attachment: true,
            question_ID: this.content[this.focusingIndex]._id,
            UUID: this.user.UUID,
            cancel: false,
          };
        } else {
          json = {
            attachment: false,
            question_ID: this.questionList[key]._id,
            UUID: this.user.UUID,
            cancel: false,
          };
        }
        collect_pro(json)
          .then((response) => {
            if (response.state === true) {
              this.getCollection(this.quesCollectionIdList);
            } else {
              this.$Message.error(response.msg);
            }
          })
          .catch((error) => {
            this.$Message.error("获取收藏状态失败");
          });
      }
    },
    ToMoreDemo() {
      this.$router.push({
        name: "demoPractise",
      });
    },
    toHomeWork() {
      this.$router.push({
        name: "homework",
      });
    },
    toDemoPractise(id) {
      sessionStorage.setItem(
        "runnob",
        JSON.stringify({
          from: "demoPractise",
          demoId: id,
        })
      );
      this.$router.push({
        name: "runnob",
      });
    },
    getCollection(list) {
      getCollectionFlags({
        UUID: JSON.parse(this.$store.state.user).UUID,
        list: list,
      })
        .then((res) => {
          if (res.state === true) {
            this.collectionFlagList = res.result;
          } else {
            this.$Message.error("获取收藏状态失败");
          }
        })
        .catch((err) => {
          this.$Message.error("获取收藏状态失败");
        });
    },
    formatDate(time) {
      let t = new Date(time);
      let year = t.getFullYear();
      let month =
        t.getMonth() + 1 < 10 ? `0${t.getMonth() + 1}` : t.getMonth() + 1;
      let date = t.getDate() < 10 ? `0${t.getDate()}` : t.getDate();
      let hour = t.getHours() < 10 ? `0${t.getHours()}` : t.getHours();
      let minute = t.getMinutes() < 10 ? `0${t.getMinutes()}` : t.getMinutes();
      return `${year}-${month}-${date}　${hour}:${minute}`;
    },
    formatABC(index) {
      let str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
      return str[index];
    },
    addComment() {
      this.$refs.comment.addComment();
    },

    fontNumLimit(value) {
      var temp = value.replace(/<\/?.+?>/g, "");
      var result = temp.replace(/ /g, ""); //result为获取冲文字得到后的内容
      //         获取img标签
      var re = /<img[^>]+>/g;
      var ImgA = value.match(re);
      let imgLen;
      if (ImgA) {
        imgLen = ImgA.length;
      }
      if (!ImgA) {
        imgLen = 0;
      }
      let spanInfo = imgLen + result.length;
      if (spanInfo >= 15) {
        return true;
      } else {
        return false;
      }
    },

    shareNote() {
      if (!this.fontNumLimit(this.editorContent)) {
        this.$Message.error("笔记字数至少要在15字以上");
        return;
      }
      add_note({
        UUID: JSON.parse(this.$store.state.user).UUID,
        pointId: this.content[this.focusingIndex]._id,
        time: +new Date(),
        note: this.editorContent,
        username: JSON.parse(this.$store.state.user).username,
        avatar: this.user.avatar,
      })
        .then((res) => {
          if (res.state) {
            this.$Message.success("分享笔记成功");
            this.getNoteList();
            // 关闭添加笔记编辑框
            this.addNoteFlag = false;
            this.editorContent = "笔记字数至少要在15字以上...";
          } else {
            this.$Message.error(response.msg);
          }
        })
        .catch((error) => {
          this.$Message.error("分享笔记失败");
        });
    },
    addNote() {
      this.addNoteFlag = true;
      let date = new Date();
      this.local_date = `${date.getFullYear()}-${
        date.getMonth() + 1
      }-${date.getDate()}`;
      var editor = new E(this.$refs.note);
      editor.customConfig.onchange = (html) => {
        this.editorContent = html;
      };
      var url = "";
      if (process.env.NODE_ENV === "development") {
        url = "http://localhost:8080/api/uploadImg";
      } else if (process.env.NODE_ENV === "production") {
        url = "https://www.ourspark.org/api/uploadImg";
      }
      editor.customConfig.uploadImgServer = url; // 上传图片到服务器
      editor.customConfig.zIndex = 0;
      editor.create();
      editor.txt.html("笔记字数至少要在15字以上...");
      setTimeout(() => {
        let it = document.getElementById("add-note");
        it.scrollIntoView();
      }, 1);
    },
    toTarget(link) {
      let ss = /^(\w+_)?\w+,\d+,\d+$/;
      if (!ss.test(link)) {
        this.$router.push({
          name: link,
        });
        return;
      }
      this.$router.push({
        name: "index",
        params: {
          menu: link,
        },
      });
      let classname = link.split(",")[0];
      switch (classname) {
        case "js":
          this.toJS();
          break;
        case "wx":
          this.toWX();
          break;
        case "ydhlw":
          this.toYDHLW();
          break;
        case "wx_new":
          this.toWxNew();
          break;
      }
    },
    scrollTo(target) {
      let it = document.getElementById(target);
      it.scrollIntoView();
    },
    exitFocus() {
      // 重置聚焦知识点
      this.focusingIndex = -1;
      //  退出视图
      this.focusPoint = false;
      // sessionStorage.setItem('focusPoint', JSON.stringify({
      //   open: this.focusPoint,
      //   index: this.focusingIndex
      // }));
      // 关闭添加笔记编辑框
      this.addNoteFlag = false;
      this.editorContent = "笔记字数至少要在15字以上...";
      // 退出聚焦，清空列表信息
      this.questionList = [];
    },
    getNoteList() {
      get_notes({
        pointId: this.content[this.focusingIndex]._id,
      })
        .then((res) => {
          if (res.state) {
            this.noteList = res.msg;
          } else {
            this.$Message.error(response.msg);
          }
        })
        .catch((error) => {
          this.$Message.error("获取笔记失败");
        });
    },

    getQuestionsList() {
      this.questionList.push({
        answer: [],
        illustrationContent: "",
        bloom: this.content[this.focusingIndex].bloom,
        items: this.content[this.focusingIndex].practice.items,
        question: this.content[this.focusingIndex].practice
          .question_editor_Content,
        type: this.content[this.focusingIndex].practice.type,
      });
      this.quesCollectionIdList = [];
      this.quesCollectionIdList.push({
        id: this.content[this.focusingIndex]._id,
        attachment: true,
      });
      getAllQuestions({
        point_id: this.content[this.focusingIndex]._id,
      })
        .then((response) => {
          if (response.state === true) {
            for (let i = 0; i < response.result.length; i++) {
              this.questionList.push(response.result[i]);
              this.quesCollectionIdList.push({
                id: response.result[i]._id,
                attachment: false,
              });
              this.getCollection(this.quesCollectionIdList);
            }
          } else {
            this.$Message.error(response.msg);
          }
        })
        .catch((error) => {
          this.$Message.error("获取知识点题目失败");
        });
    },
    focusOpen(index) {
      this.focusingIndex = index;
      this.focusPoint = true;
      // sessionStorage.setItem('focusPoint', JSON.stringify({
      //   open: this.focusPoint,
      //   index: this.focusingIndex
      // }));
      this.getNoteList();
      this.getQuestionsList();
    },
    hoveredPoint(id) {
      if (this.hoveringId === id) return;
      this.hoveringId = id;
    },
    hoveredPointEnd() {
      this.hoveringId = "";
    },

    tabToPointView() {
      this.viewFlag = 0;
      sessionStorage.setItem("viewFlag", this.viewFlag);
    },
    tabToWordView() {
      this.viewFlag = 1;
      sessionStorage.setItem("viewFlag", this.viewFlag);
      get_wordviewFlag({
        UUID: JSON.parse(this.$store.state.user).UUID,
      })
        .then((res) => {
          if (res.state) {
            this.wordViewGuide = res.res;

            // 自定义事件，用于触发插件
            // 创建事件
            var evt = document.createEvent("Event");
            // 定义事件类型
            evt.initEvent("customEvent", true, true);
            window.dispatchEvent(evt);
          } else {
            this.$Message.error(response.msg);
          }
        })
        .catch((error) => {
          this.$Message.error(error);
        });
    },
    closeGuide() {
      this.wordViewGuide = true;
      this.notShowMessage = false;
    },
    guideFinish() {
      if (!this.notShowMessage) {
        this.wordViewGuide = true;
        return;
      }
      add_wordviewFlag({
        UUID: JSON.parse(this.$store.state.user).UUID,
      })
        .then((res) => {
          if (res.state) {
            this.wordViewGuide = true;
            this.notShowMessage = false;
          } else {
            this.$Message.error(response.msg);
          }
        })
        .catch((error) => {
          this.$Message.error(error);
        });
    },
    delpath(id) {
      this.$confirm("此操作将永久删除该路径, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          deleteLearnPath({
            _id: id,
          })
            .then((res) => {
              if (res.state === true) {
                this.$Message.success(res.msg);
                return getCreateLearnPath({
                  authorUUID: JSON.parse(this.$store.state.user).UUID,
                });
              } else {
                this.$Message.error(res.msg);
              }
            })
            .then((res) => {
              if (res.state === true) {
                this.pathCreatedList = res.learn_path;
              }
            })
            .catch((error) => {
              this.$Message.error("删除学习路径失败");
            });
        })
        .catch(() => {
          this.$Message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    editpath(index) {
      this.addnewORedit = false;
      this.pathlistOrEdit = !this.pathlistOrEdit;
      if (document.getElementById("pathbox") != null && this.showpathFlag) {
        setTimeout(() => {
          let pathBoxHeight = document.getElementById("pathbox").clientHeight;
          this.tagnumber = parseInt(pathBoxHeight / 35);
        }, 100);
      }
      this.tags = JSON.stringify(this.pathCreatedList[index].path);
      this.pathName = this.pathCreatedList[index].pathName;
      this.flags = this.pathCreatedList[index].flags;
      this.editingId = this.pathCreatedList[index]._id;

      this.pathsaved = JSON.parse(this.tags).findIndex((item) => {
        return item.content._id === this.content[this.showPoint]._id;
      });
    },
    pathpageup() {
      this.pathpage++;
    },
    pathpagedown() {
      this.pathpage--;
    },
    handleCommand(command) {
      this.nowpathName = this.pathlist[command].pathName;
      this.tags = JSON.stringify(this.pathlist[command].path);
    },
    PathSave() {
      let list = JSON.parse(this.tags);
      if (this.flags.length === 0) {
        this.$alert("请您选择推荐路径面向的群体！", "提示");
        return;
      }
      if (this.pathName === "") {
        this.$alert("路径名称不能为空哦！", "提示");
        return;
      }
      if (this.addnewORedit) {
        add_learnpath({
          UUID: JSON.parse(this.$store.state.user).UUID,
          flags: this.flags,
          path: list,
          pathName: this.pathName,
        })
          .then((res) => {
            if (res.state === true) {
              this.showPathSave = false;
              this.$Message.success("添加推荐路径成功");

              return getCreateLearnPath({
                authorUUID: JSON.parse(this.$store.state.user).UUID,
              });
            } else {
              this.$Message.error(res.msg);
            }
          })
          .then((res) => {
            if (res.state === true) {
              this.pathCreatedList = res.learn_path;
            }
          })
          .catch((error) => {
            this.$Message.error("添加学习路径失败");
          });
      } else {
        updateLearnPath({
          _id: this.editingId,
          flags: this.flags,
          pathName: this.pathName,
          path: list,
        })
          .then((res) => {
            if (res.state === true) {
              this.$Message.success(res.msg);

              return getCreateLearnPath({
                authorUUID: JSON.parse(this.$store.state.user).UUID,
              });
            } else {
              this.$Message.error(res.msg);
            }
          })
          .then((res) => {
            if (res.state === true) {
              this.pathCreatedList = res.learn_path;
            }
          })
          .catch((error) => {
            this.$Message.error("更新学习路径失败");
          });
      }
      this.pathlistOrEdit = !this.pathlistOrEdit;
      this.showPathSave = false;
    },
    addToPathBtn(i) {
      if (this.userGroup === "0") {
        return;
      }
      let pathBoxHeight = document.getElementById("pathbox").clientHeight;
      this.tagnumber = parseInt(pathBoxHeight / 35);
      let list = JSON.parse(this.tags);
      let that = this;
      let index = list.findIndex(function (item) {
        return item.content._id == that.content[i]._id;
      });
      let str = this.content[i].title;
      if (this.content[i].title.length > 8) {
        str = this.content[i].title.substring(0, 8) + "…";
      }
      let it = {};
      it.title = str;
      it.content = {
        _id: this.content[i]._id,
        title: this.content[i].title,
        menu: this.content[i].menu,
        seq: this.content[i].seq,
      };
      if (index === -1) {
        list.push(it);
      } else {
        list.splice(index, 1);
      }
      this.tags = JSON.stringify(list);
      sessionStorage.setItem("learnpath", this.tags);
      //是否已加入路径
      this.pathsaved = JSON.parse(this.tags).findIndex((item) => {
        return item.content._id === this.content[this.showPoint]._id;
      });
    },
    savepath() {
      let list = JSON.parse(this.tags);
      if (list.length === 0) {
        this.$Message.error("您还未添加任何路径");
        return;
      }
      this.showPathSave = true;
    },
    toPage(item) {
      let that = this;
      let new_menu = item.content.menu.split(",");
      if (item.content.menu !== that.$route.params.menu) {
        this.getOnePage(
          `${new_menu[0]},-1,-1`,
          parseInt(new_menu[1]),
          parseInt(new_menu[2])
        );
      }
      let _getMenu = (lesson) => {
        return new Promise((resolve, reject) => {
          getMenu({ lesson: lesson, UUID: sessionStorage.UUID })
            .then((response) => {
              if (response.state === true) {
                let allMenu = [];
                that.menu = response.result.menu;
                that.menu.forEach((item, index) => {
                  item.subtitle.forEach((v, k) => {
                    allMenu.push(`${lesson},${index},${k}`);
                  });
                });
                allMenu.push(`${lesson},${that.menu.length},0`);
                that.allMenu = allMenu;
                if (lesson == "wx") {
                  that.process = response.process.process[1];
                } else if (lesson == "js") {
                  that.process = response.process.process[0];
                } else if (lesson == "ydhlw") {
                  that.process = response.process.process[2];
                }
                //                that.process=['js,2,1',-1,'2'];
                that.left_process = that.process[0].split(",");
                if (that.left_process[1] == -1 && that.left_process[2] == -1) {
                  //js,-1,-1
                  that.left_process[1] = 0;
                  that.left_process[2] = 0;
                }
                sessionStorage.left_process = that.left_process;
                sessionStorage.process = `${that.process[0]}&${that.process[1]}&${that.process[2]}`;
                resolve();
              } else {
                this.$Message.error(response.msg);
              }
            })
            .catch((error) => {
              this.$Message.error("获取课程目录失败");
            });
        });
      };
      let expand = () => {
        that.active = new_menu[1] + "-" + new_menu[2];
        //          this.active = "0-0";
        that.openNames = [new_menu[1]];

        that.$nextTick(() => {
          // iview menu 动态数据绑定, activeMenu改变时，手动更新
          that.$refs.menu.updateOpened();
          that.$refs.menu.updateActiveName();
        });
      };
      let i = 0;
      var timer = setInterval(function () {
        i++;
        if (item.content.menu === that.$route.params.menu || i > 100) {
          _getMenu(new_menu[0]).then(expand);
          // that.update_content(true);
          let index = that.content.findIndex((ele) => {
            return ele._id === item.content._id;
          });
          that.handleCurrentChange(index + 1);
          clearTimeout(timer);
        }
      }, 50);
    },
    addnewpath() {
      this.pathsaved = -1;
      this.addnewORedit = true;
      this.pathlistOrEdit = !this.pathlistOrEdit;
      if (document.getElementById("pathbox") != null && this.showpathFlag) {
        setTimeout(() => {
          let pathBoxHeight = document.getElementById("pathbox").clientHeight;
          this.tagnumber = parseInt(pathBoxHeight / 35);
        }, 100);
      }
      this.tags = JSON.stringify([]);
      this.pathName = "";
      this.flags = [];
    },
    canceladdnewpath() {
      this.pathsaved = -1; //知识点加入路径标识复位
      this.pathlistOrEdit = !this.pathlistOrEdit;
      setTimeout(() => {
        if (document.getElementById("pathbox") != null && this.showpathFlag) {
          let pathBoxHeight = document.getElementById("pathbox").clientHeight;
          this.tagnumber = parseInt(pathBoxHeight / 35);
        }
      }, 100);
    },
    showpath() {
      this.showpathFlag = !this.showpathFlag;
      if (this.userGroup !== "0") {
        getCreateLearnPath({
          authorUUID: JSON.parse(this.$store.state.user).UUID,
        })
          .then((res) => {
            if (res.state === true) {
              this.pathCreatedList = res.learn_path;
            }
          })
          .catch((error) => {
            this.$Message.error(error);
          });
        return;
      }
      getLearnPath({ flags: JSON.parse(this.$store.state.user).flags })
        .then((res) => {
          if (res.state === true) {
            this.pathlist = res.learn_path;
            if (this.pathlist.length !== 0) {
              this.tags = JSON.stringify(this.pathlist[0].path);
            }
            this.nowpathName = this.pathlist[0].pathName;
          } else {
            this.$Message.error(res.msg);
          }
        })
        .catch((error) => {
          this.$Message.error("获取学习路径失败");
        });
    },
    deltag(id, e) {
      let list = JSON.parse(this.tags);
      let that = this;
      let index = list.findIndex(function (item) {
        return item.content._id == id;
      });
      if (index !== -1) {
        //防止误删标签
        list.splice(index, 1);
      }
      this.tags = JSON.stringify(list);
      sessionStorage.setItem("learnpath", this.tags);
    },
    dragendfun() {
      this.sameDrag = 0;
      //是否已加入路径
      this.pathsaved = JSON.parse(this.tags).findIndex((item) => {
        return item.content._id === this.content[this.showPoint]._id;
      });
    },
    dragstart(i) {
      if (this.userGroup === "0") {
        return;
      }
      if (this.sameDrag === 0) {
        let str = this.content[i].title;
        if (this.content[i].title.length > 8) {
          str = this.content[i].title.substring(0, 8) + "…";
        }
        this.dragcontent.title = str;
        this.dragcontent.content = {
          _id: this.content[i]._id,
          title: this.content[i].title,
          menu: this.content[i].menu,
          seq: this.content[i].seq,
        };
      }
    },
    dragstart2(i) {
      //拖拽标签
      if (this.sameDrag === 0) {
        this.sameDrag = +new Date();
        let list = JSON.parse(this.tags);
        this.dragcontent = list[i];
        this.lastDrag = i;
      }
    },
    dropdrag2(e) {
      if (this.userGroup === "0") {
        return;
      }
      let pathBoxHeight = document.getElementById("pathbox").clientHeight;
      this.tagnumber = parseInt(pathBoxHeight / 35);
      //进入推荐路径区域（默认暂时将其加到最后）
      let list = JSON.parse(this.tags);
      let that = this;
      let index = list.findIndex(function (item) {
        return item.content._id == that.dragcontent.content._id;
      });
      if (list.length === 0 || index === -1) {
        list.push(this.dragcontent);
        this.lastDrag = list.length - 1;
      } else {
        this.lastDrag = index;
      }
      this.tags = JSON.stringify(list);

      sessionStorage.setItem("learnpath", this.tags);
    },
    dropdrag(e) {
      if (this.userGroup === "0") {
        return;
      }
      let pathBoxHeight = document.getElementById("pathbox").clientHeight;
      this.tagnumber = parseInt(pathBoxHeight / 35);
      //拖到标签上方（改变标签位置）
      let list = JSON.parse(this.tags);
      let that = this;
      if (e.currentTarget.id != this.lastDrag) {
        //从card拖入 ,交换标签位置
        let index = list.findIndex(function (item) {
          return item.content._id === that.dragcontent.content._id;
        });
        if (index !== -1) {
          //防止过快拖动时误删标签
          list.splice(index, 1);
        }
        list.splice(e.currentTarget.id, 0, that.dragcontent);
        that.lastDrag = e.currentTarget.id;
      }
      this.tags = JSON.stringify(list);

      sessionStorage.setItem("learnpath", this.tags);
    },
    dropdragleave(e) {
      //拖离推荐路径区域（移除相应标签）
      if (this.userGroup === "0") {
        return;
      }
      let o = document.getElementById("pathout");
      let p = document.getElementById("path");
      let r = document.getElementById("layout-point");
      if (
        window.event.clientX < r.offsetLeft + p.offsetLeft + o.offsetLeft ||
        window.event.clientY - 1 < r.offsetTop + p.offsetTop + o.offsetTop
      ) {
        let that = this;
        let list = JSON.parse(this.tags);

        let index = list.findIndex(function (item) {
          return item.content._id === that.dragcontent.content._id;
        });
        if (index !== -1) {
          //防止删错标签
          list.splice(index, 1);
          this.tags = JSON.stringify(list);

          sessionStorage.setItem("learnpath", this.tags);
        }
      }
    },
    toAllQuestion(index) {
      this.$router.push({
        name: "pointAllQuestion",
        params: {
          point: this.content[index],
        },
      });
      sessionStorage.setItem(
        "quesPoint",
        JSON.stringify({
          point: this.content[index],
        })
      );
      sessionStorage.setItem("pathList", JSON.stringify(this.breadcrumbList2));
    },
    connectUs() {
      this.showComt = true;
    },
    cancel() {
      this.showComt = false;
    },
    //      allquestion(){//套题
    //          this.$router.push({
    //              name: "allquestion",
    //              params: {
    //                  menu: this.$route.params.menu
    //              }
    //          });
    //      },
    allAnswer(index) {
      this.$router.push({
        name: "allanswer",
        params: {
          point: this.content[index],
        },
      });
      sessionStorage.setItem(
        "answerPoint",
        JSON.stringify({
          point: this.content[index],
        })
      );
      sessionStorage.setItem("pathList", JSON.stringify(this.breadcrumbList2));
    },
    showmorePointMsg() {
      this.showmorePointMsgflag = !this.showmorePointMsgflag;
    },
    doExercise(index, flag) {
      let new_arr = this.$route.params.menu.split(",");
      if (
        this.left_process[0] == new_arr[0] &&
        new_arr[1] >= this.left_process[1] &&
        new_arr[2] >= this.left_process[2]
      ) {
        flag = flag;
      } else {
        flag = 0;
      }
      let last = false;
      let nowIndex = "";
      if (index === this.content.length - 1) {
        last = true;
        nowIndex = this.allMenu.indexOf(this.$route.params.menu);
      }
      sessionStorage.removeItem("currentQuestion");
      sessionStorage.removeItem("questionList");
      sessionStorage.setItem(
        "currentPoint",
        JSON.stringify({
          point: this.content[index],
          last: last,
          flag: flag,
        })
      );
      sessionStorage.setItem("pathList", JSON.stringify(this.breadcrumbList2));
      this.$router.push({
        name: "doExercise",
      });
    },
    toOnlineCoding(index, temp) {
      let flag = temp.split(",")[1];
      if (flag == "2") flag = 1;
      else if (flag == "3") flag = 2;
      sessionStorage.setItem(
        "runnob",
        JSON.stringify({
          from: "index",
          point: this.content[index],
          flag: flag,
        })
      );
      this.$router.push({
        name: "runnob",
      });
    },
    pageUp() {
      if (this.currentPage !== this.content.length) {
        this.showPoint++;
        //是否已加入路径
        this.pathsaved = JSON.parse(this.tags).findIndex((item) => {
          return item.content._id === this.content[this.showPoint]._id;
        });
        this.currentPage++;
        sessionStorage.setItem("pointPage", JSON.stringify(this.currentPage));
        let json = {};
        json = {
          UUID: JSON.parse(this.$store.state.user).UUID,
          userGroup: this.userGroup,
          pointId: this.content[this.showPoint]._id,
          menu: this.$route.params.menu,
          seq: this.content[this.showPoint].seq,
          time: +new Date(),
          view: this.viewFlag?'word':'point'
        };
        add_PointProcess(json)
          .then((response) => {
            if (response.state === true) {
              // console.log("ok");
            } else {
              this.$Message.error(response.msg);
            }
          })
          .catch((error) => {
            this.$Message.error("获取用户进度失败");
          });
      }
    },
    pageDown() {
      if (this.currentPage !== 1) {
        this.showPoint--;
        this.currentPage--;
        //是否已加入路径
        this.pathsaved = JSON.parse(this.tags).findIndex((item) => {
          return item.content._id === this.content[this.showPoint]._id;
        });
        sessionStorage.setItem("pointPage", JSON.stringify(this.currentPage));
        let json = {};
        json = {
          UUID: JSON.parse(this.$store.state.user).UUID,
          userGroup: this.userGroup,
          pointId: this.content[this.showPoint]._id,
          menu: this.$route.params.menu,
          seq: this.content[this.showPoint].seq,
          time: +new Date(),
          view: this.viewFlag?'word':'point'
        };
        add_PointProcess(json)
          .then((response) => {
            if (response.state === true) {
              // console.log("ok");
            } else {
              this.$Message.error(response.msg);
            }
          })
          .catch((error) => {
            this.$Message.error("获取用户进度失败");
          });
      }
    },
    handleCurrentMouseover(i) {
      this.pointtitle = this.content[i - 1].title;
    },
    handleCurrentChange(val) {
      this.showPoint = val - 1;
      this.currentPage = val;
      //是否已加入路径
      this.pathsaved = JSON.parse(this.tags).findIndex((item) => {
        return item.content._id === this.content[this.showPoint]._id;
      });
      sessionStorage.setItem("pointPage", JSON.stringify(this.currentPage));
      let json = {};
      json = {
        UUID: JSON.parse(this.$store.state.user).UUID,
        userGroup: this.userGroup,
        pointId: this.content[this.showPoint]._id,
        menu: this.$route.params.menu,
        seq: this.content[this.showPoint].seq,
        time: +new Date(),
        view: this.viewFlag?'word':'point'
      };
      add_PointProcess(json)
        .then((response) => {
          if (response.state === true) {
            // console.log("ok");
          } else {
            this.$Message.error(response.msg);
          }
        })
        .catch((error) => {
          this.$Message.error("获取用户进度失败");
        });
    },
    handleMenuClick(data) {
      this.getOnePage(
        this.$route.params.menu,
        data.index,
        data.key,
        data.goback ? true : false
      );
    },
    getOnePage(current_menu, index, key, goback = false) {
      // 点击当前菜单 直接返回
      let last_menu = current_menu.split(",");
      if (last_menu[1] == index && last_menu[2] == key && !goback) return;

      this.showPoint = 0;
      this.currentPage = 1;
      //是否已加入路径

      sessionStorage.setItem("pointPage", JSON.stringify(1));
      var temp = current_menu.split(",");
      this.showIndex = -1;
      if (temp[1] !== index + "" || temp[2] !== key + "" || goback) {
        var new_url = temp[0] + "," + index + "," + key;
        getContent({ menu: new_url })
        .then((response) => {
          if (response.state === true) {
            this.getPreAndNext(new_url);

            let result_temp = [];
            if (response.result.length !== 0) {
              result_temp = [response.result[0]];
              for (let i = 1; i < response.result.length; i++) {
                if (response.result[i].seq > result_temp[i - 1].seq) {
                  result_temp.push(response.result[i]);
                } else {
                  for (let j = 0; j < result_temp.length; j++) {
                    if (result_temp[j].seq + 1 === response.result[i].seq) {
                      result_temp.splice(j + 1, 0, response.result[i]);
                      break;
                    }
                  }
                }
              }
            }
            result_temp.forEach((item, index) => {
              if (this.process[2] == item._id) {
                this.showIndex = index;
              }
            });
            this.content = result_temp;
            this.pathsaved = JSON.parse(this.tags).findIndex((item) => {
              return item.content._id === this.content[this.showPoint]._id;
            });
            if (!goback) {
              this.$router.push({
                name: "index",
                params: {
                  menu: new_url,
                },
              });
            }
          } else {
            this.$Message.error(response.msg);
          }
        })
        .catch((error) => {
          console.log(error)
          this.$Message.error(error);
        });
      }

      let json = {};
      json = {
        UUID: JSON.parse(this.$store.state.user).UUID,
        userGroup: this.userGroup,
        pointId: this.content[this.showPoint]._id,
        menu: this.$route.params.menu,
        seq: this.content[this.showPoint].seq,
        time: +new Date(),
        view: this.viewFlag?'word':'point'
      };
      add_PointProcess(json)
      .then((response) => {
        if (response.state === true) {
          // console.log("ok");
        } else {
          this.$Message.error(response.msg);
        }
      })
      .catch((error) => {
        this.$Message.error("获取用户进度失败");
      });
    },
    deleteThisPoint(_id, idx) {
      this.$Modal.confirm({
        title: "确认",
        content: "确认要删除这个知识点吗？",
        onOk: () => {
          deletePoint({
            menu: this.$route.params.menu,
            pointId: _id,
          })
            .then((response) => {
              if (response.state === true) {
                this.$Message.success("删除成功");
                this.content.splice(idx, 1);
              } else {
                this.$Message.error("删除失败！ " + response.msg);
              }
            })
            .catch((error) => {
              this.$Message.error("删除知识点失败");
            });
        },
      });
    },
    giveQuestion(_seq, _id) {
      sessionStorage.setItem("pathList", JSON.stringify(this.breadcrumbList2));
      this.$router.push({
        name: "giveQuestion",
        params: {
          position: this.$route.params.menu,
          seq: _seq,
          _id: _id,
          state: "new",
        },
      });
    },
    editPoint(_id, _seq, index) {
      sessionStorage.setItem("pathList", JSON.stringify(this.breadcrumbList2));
      sessionStorage.setItem(
        "editParams",
        JSON.stringify({
          state: "edit",
          position: this.$route.params.menu,
          pointId: _id,
          seq: _seq,
          point: this.content[index],
        })
      );
      this.$router.push({
        name: "edit_point",
      });
    },
    more_point(_seq, _id) {
      this.$router.push({
        name: "more_point",
        params: {
          state: "new",
          position: this.$route.params.menu,
          seq: _seq,
          _id: _id,
        },
      }); // 只能用 name
    },
    toPoint0() {
      sessionStorage.setItem("pathList", JSON.stringify(this.breadcrumbList2));
      sessionStorage.setItem(
        "editParams",
        JSON.stringify({
          state: "new",
          position: this.$route.params.menu,
          seq: -1,
        })
      );
      this.$router.push({
        name: "edit_point",
      }); // 只能用 name
    },
    toPoint(_seq) {
      sessionStorage.setItem("pathList", JSON.stringify(this.breadcrumbList2));
      sessionStorage.setItem(
        "editParams",
        JSON.stringify({
          state: "new",
          position: this.$route.params.menu,
          seq: _seq,
        })
      );
      this.$router.push({
        name: "edit_point",
      }); // 只能用 name
    },
    toJS() {
      this.mymenu++;
      this.update_content(true);
      sessionStorage.setItem("pointPage", JSON.stringify(1));
      this.showPoint = 0;
      this.currentPage = 1;
    },
    toWX() {
      this.mymenu++;
      this.update_content(true);
      sessionStorage.setItem("pointPage", JSON.stringify(1));
      this.showPoint = 0;
      this.currentPage = 1;
    },
    toYDHLW() {
      this.mymenu++;
      this.update_content(true);
      sessionStorage.setItem("pointPage", JSON.stringify(1));
      this.showPoint = 0;
      this.currentPage = 1;
      console.log('opopo')
    },
    toWxNew() {
      this.mymenu++;
      this.update_content(true);
      sessionStorage.setItem("pointPage", JSON.stringify(1));
      this.showPoint = 0;
      this.currentPage = 1;
    },
    toPreOrNext(target){
      let menu = target.split(",");
      this.getOnePage(this.$route.params.menu, parseInt(menu[1]), parseInt(menu[2]));
      document.documentElement.scrollTop = document.body.scrollTop = 0;  // 手动重置滚动条到顶部
    },
    getPreAndNext(current_menu){
      // 获取上一章节和下一章节信息
      let menu_arr = current_menu.split(',')
      if(parseInt(menu_arr[1]) === 0 && parseInt(menu_arr[2]) === 0){
        this.preSection = {
          name: '',
          link: ''
        }
      } else if(parseInt(menu_arr[1]) > 0 && parseInt(menu_arr[2]) === 0){
        this.preSection = {
          name: this.menu[parseInt(menu_arr[1])-1].subtitle[this.menu[parseInt(menu_arr[1])-1].subtitle.length-1],
          link: `${menu_arr[0]},${parseInt(menu_arr[1])-1},${this.menu[parseInt(menu_arr[1])-1].subtitle.length-1}`
        }
      } else {
        this.preSection = {
          name: this.menu[parseInt(menu_arr[1])].subtitle[parseInt(menu_arr[2])-1],
          link: `${menu_arr[0]},${parseInt(menu_arr[1])},${parseInt(menu_arr[2])-1}`
        }
      }

      if(parseInt(menu_arr[1]) === this.menu.length-1 && parseInt(menu_arr[2]) === this.menu[parseInt(menu_arr[1])].subtitle.length-1){
        this.nextSection = {
          name: '',
          link: ''
        }
      } else if(parseInt(menu_arr[1]) < this.menu.length-1 && parseInt(menu_arr[2]) === this.menu[parseInt(menu_arr[1])].subtitle.length-1){
        this.nextSection = {
          name: this.menu[parseInt(menu_arr[1])+1].subtitle[0],
          link: `${menu_arr[0]},${parseInt(menu_arr[1])+1},0`
        }
      } else {
        this.nextSection = {
          name: this.menu[parseInt(menu_arr[1])].subtitle[parseInt(menu_arr[2])+1],
          link: `${menu_arr[0]},${parseInt(menu_arr[1])},${parseInt(menu_arr[2])+1}`
        }
      }
    },
    update_content(params) {
      this.loading = true;
      sessionStorage.mymenu = this.mymenu;
      let that = this;
      let menu_raw = this.$route.params.menu;
      let _getContent = (_menu_) => {
        return new Promise((resolve, reject) => {
          getContent(_menu_)
            .then((response) => {
              if (response.state === true) {
                let result_temp = [];
                if (response.result.length !== 0) {
                  result_temp = [response.result[0]];
                  for (let i = 1; i < response.result.length; i++) {
                    if (response.result[i].seq > result_temp[i - 1].seq) {
                      result_temp.push(response.result[i]);
                    } else {
                      for (let j = 0; j < result_temp.length; j++) {
                        if (result_temp[j].seq + 1 === response.result[i].seq) {
                          result_temp.splice(j + 1, 0, response.result[i]);
                          break;
                        }
                      }
                    }
                  }
                }

                result_temp.forEach((item, index) => {
                  if (this.process[2] == item._id) {
                    this.showIndex = index;
                  }
                });
                this.content = result_temp;

                
                let json = {};
                json = {
                  UUID: JSON.parse(this.$store.state.user).UUID,
                  userGroup: this.userGroup,
                  pointId: this.content[this.showPoint]._id,
                  menu: this.$route.params.menu,
                  seq: this.content[this.showPoint].seq,
                  time: +new Date(),
                  view: this.viewFlag?'word':'point'
                };
                add_PointProcess(json)
                .then((response) => {
                  if (response.state === true) {
                    // console.log("ok");
                  } else {
                    this.$Message.error(response.msg);
                  }
                })

                this.showPoint = 0;
                this.currentPage = 1;

                this.loading = false;
                resolve();
              } else {
                this.$Message.error(response.msg);
              }
            })
            .catch((error) => {
              console.log(error)
              this.$Message.error("获取知识点内容出错");
              this.loading = false;
            });
        });
      };

      let _getMenu = (lesson) => {
        return new Promise((resolve, reject) => {
          getMenu({ lesson: lesson, UUID: sessionStorage.UUID })
            .then((response) => {
              if (response.state === true) {
                let allMenu = [];
                that.menu = response.result.menu;
                that.getPreAndNext(that.$route.params.menu);
                that.menu.forEach((item, index) => {
                  item.subtitle.forEach((v, k) => {
                    allMenu.push(`${lesson},${index},${k}`);
                  });
                });
                allMenu.push(`${lesson},${that.menu.length},0`);
                that.allMenu = allMenu;
                if (lesson == "wx") {
                  that.process = response.process.process[1];
                } else if (lesson == "js") {
                  that.process = response.process.process[0];
                } else if (lesson == "ydhlw") {
                  that.process = response.process.process[2];
                } else if (lesson == "wx_new") {
                  that.process = response.process.process[3];
                }
                //                that.process=['js,2,1',-1,'2'];
                that.left_process = that.process[0].split(",");
                if (that.left_process[1] == -1 && that.left_process[2] == -1) {
                  //js,-1,-1
                  that.left_process[1] = 0;
                  that.left_process[2] = 0;
                }
                sessionStorage.left_process = that.left_process;
                sessionStorage.process = `${that.process[0]}&${that.process[1]}&${that.process[2]}`;
                _getContent({ menu: menu_raw });
                resolve();
              } else {
                this.$Message.error(response.msg);
              }
            })
            .catch((error) => {
              this.$Message.error("获取课程目录失败");
            });
        });
      };

      if (menu_raw) {
        let menu = menu_raw.split(",");
        let expand = () => {
          this.active = menu[1] + "-" + menu[2];
          //          this.active = "0-0";
          if (params) {
            this.openNames = ["0"];
          } else {
            this.openNames = [menu[1]];
          }
        };
        _getMenu(menu[0]).then(expand);
      }
    },
  },
};
</script>